﻿using AnesSystem.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace AnesSystem.Converters
{
    class PatientEventsCode2PatientEvent : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                if (value == null) return "";

                if (DataManager.Instance.Code2events.ContainsKey(value.ToString()))
                {
                    return DataManager.Instance.Code2events[value.ToString()].Name;
                }
                else
                {
                    return value;
                }
               

            }
            catch (Exception ex)
            {
                Common.LogHelper.Error(this.GetType(), ex);
                return value;

            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
            //throw new NotImplementedException();
        }
    }
}
